package cn.gz.demo.ui.pic;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import androidx.databinding.DataBindingUtil;

import cn.gz.demo.R;
import cn.gz.demo.databinding.PicDetailsBinding;
import cn.gz.demo.ui.base.BaseActivity;

/**
 * @author Liuyz
 * @date 2020/10/10 17:50
 */
public class PicDetailsActivity extends BaseActivity {
    private PicDetailsBinding binding;
    private Bundle bundle;
    private int locationX;
    private int locationY;
    private int width;
    private int height;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_pic_details);

        bundle = getIntent().getExtras();
        if (bundle != null) {
            if (bundle.containsKey("locationX")) {
                locationX = bundle.getInt("locationX");
            }
            if (bundle.containsKey("locationY")) {
                locationY = bundle.getInt("locationY");
            }
            if (bundle.containsKey("width")) {
                width = bundle.getInt("width");
            }
            if (bundle.containsKey("height")) {
                height = bundle.getInt("height");
            }
        }

        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height);
        params.setMargins(locationX, locationY, 0, 0);
        binding.icon.setLayoutParams(params);

        binding.icon.setVisibility(View.VISIBLE);
    }
}
